﻿<div class="setting">
<div class="row">
	<h3 class="text-center">设置</h3>
	<div class="col-md-4 col-md-offset-4">
	<ul class="nav navbar-nav list-inline ">
        <li><a href="" ng-click="setState(1)">个人资料</a></li>
        <li><a href="">·</a></li>
        <li><a href="" ng-click="setState(0)">修改密码</a></li>
    </ul>
    </div>
</div>
<!-- <form id="fileForm" enctype="multipart/form-data" action="uploadImage" method="post">
	<div class="form-group">
			<div class="col-md-10">
			    <input id="icon" type="text" name="text">	
			</div>
	</div>
	<div class="form-group">
			<label class="col-md-2 control-label"><img id="img1"  class="img-circle user-logo" width="50px" height="50px"></label>
			<div class="col-md-10">
			    <input id="icon" type="file" name="iconFile">	
			</div>
	</div>
	<div class="form-group">
		<div class="col-md-2 col-md-offset-2">
				<button class="btn btn-md btn-primary btn-block" type="submit" >确认</button>
			</div>
			<div class="col-md-2">
				<button class="btn btn-md btn-primary btn-block" type="button">取消</button>
			</div>
		</div>
</form> -->
<div class="row">
	<form id="user-info" class="form-horizontal" role="from" ng-show=getState()>
		<div class="form-group">
			<label class="col-md-2 control-label"><img id="img1" ng-src="{{icon}}"  class="img-circle user-logo" width="50px" height="50px"></label>
			<div class="col-md-10">
			    <input id="icon" type="file" ng-model="user.icon" name="iconFile">	
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 control-label">邮箱：</label>
			<div class="col-sm-10">
				<p class="form-control-static">{{user.id}}</p>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 control-label">昵称：</label>
			<div class="col-md-8">
				<input type="text" class="form-control" id="username" name="username" ng-model="user.username" value={{user.username}}>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 control-label">性别：</label>
			<div class="col-md-8">
				<label class="radio-inline"><input type="radio" name="optionsRadios" id="optionsRadios1" value="1"  ng-checked="getGender()" ng-click="setGender(1)">男</label>
            	<label class="radio-inline"><input type="radio" name="optionsRadios" id="optionsRadios1" value="2"  ng-checked="!getGender()" ng-click="setGender(2)">女</label>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 control-label" for="age">年龄：</label>
			<div class="col-md-8">
				<input type="text" class="form-control" name="age" id="age" ng-model="user.age" value={{user.age}}>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 control-label" for="name">姓名：</label>
			<div class="col-md-8">
				<input type="text" class="form-control" name="name" id="name" ng-model="user.name" value={{user.name}}>
			</div>
		</div>
		<div class="form-group">
			<div class="col-md-2 col-md-offset-2">
				<button class="btn btn-md btn-primary btn-block" type="button" ng-click="modifyInfo()">确认</button>
			</div>
			<div class="col-md-2">
				<button class="btn btn-md btn-primary btn-block" type="button">取消</button>
			</div>
		</div>
	</form>
	<form class="form-horizontal" name="passwordSettingForm" role="from" ng-show=!getState()>
		<div class="form-group">
			<label class="col-md-2 col-md-offset-3 control-label" for="name">当前密码：</label>
			<div class="col-md-4">
				<input type="password" required ng-model="user.password" class="form-control" name="password" id="name" placeholder="当前密码">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 col-md-offset-3 control-label" for="name">新密码：</label>
			<div class="col-md-4">
				<input type="password" required ng-minlength="6" ng-model="user.newPassword" class="form-control" name="newPassword" id="name" placeholder="6-12位新密码">
				<span class="errorMessage" ng-show="passwordSettingForm.newPassword.$dirty && passwordSettingForm.newPassword.$invalid">6-12位密码！</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-2 col-md-offset-3 control-label" for="name">确认密码：</label>
			<div class="col-md-4">
				<input type="password" required ng-minlength="6" ng-model="user.newPasswordAgain" class="form-control" name="newPasswordAgain" id="name" placeholder=确认密码>
				<span class="errorMessage" ng-show="user.passwordCheck()">两次输入的密码不一样！</span>
			</div>
		</div>
		<div class="form-group">
			<div class="col-md-2 col-md-offset-5">
				<button class="btn btn-md btn-primary btn-block" type="button" ng-disabled="passwordSettingForm.password.$invalid || passwordSettingForm.newPassword.$invalid || passwordSettingForm.newPasswordAgain.$invalid" ng-click="setPassword()">确认</button>
			</div>
			<div class="col-md-2">
				<button class="btn btn-md btn-primary btn-block" type="button">取消</button>
			</div>
		</div>
	</form>
</div>
    
</div>
<script type="text/javascript">

	$("#icon").change(function(){
		  if (this.files && this.files[0]) {
		       var reader = new FileReader();            
		       reader.onload = function (e) {
		         	$('#img1').attr('src', e.target.result);
		    }
		       reader.readAsDataURL(this.files[0]);
		   }
		});
	
	/* $('#fileForm').on('submit',(function(e) {
	   	e.preventDefault();
	   	//序列化表单   
	      var serializeData = $(this).serialize();
	      console.log('submit');
	      // var formData = new FormData(this);
	      $(this).ajaxSubmit({
	           type:'POST',
	           url: 'uploadImage',
	           dataType: 'json', 
	           data: serializeData,            
	           
	           //attention!!!   
	           contentType: false,      
	           cache: false,             
	           processData:false,      

	           success:function(data){
	               
	           },
	           error:function(data){
	               alert('上传图片出错');
	           }
	       });
	   })); */
</script>